package alp.starcode.user.controller;

import alp.starcode.framework.database.entity.User;
import alp.starcode.framework.utils.JSONResult;
import alp.starcode.user.service.UserBo;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "用户相关类")
@RestController
@RequestMapping("user")
public class UserController {

    @Autowired
    UserBo userBo;

    @PostMapping("login.do")
    public JSONResult login(@RequestBody User user){
        return JSONResult.ok(userBo.login(user));
    }

    @PostMapping("register.do")
    public JSONResult register(@RequestBody User user){
        return JSONResult.ok(userBo.register(user));
    }


}
